





//
//  FootViewTableView.m
//  住房条件帅选器
//
//  Created by MB__Lee on 2018/5/18.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "FootViewTableView.h"

#define CellHight 50
#define LastCell_hight 67


@interface FootViewTableView()<BottomViewDelegate>

@property(nonatomic,strong)BottomView *bottom;

@end


static NSString *BottomView_Identi = @"BottomView";
@implementation FootViewTableView

-(BottomView *)bottom{
    if (!_bottom) {
        _bottom = [[NSBundle mainBundle] loadNibNamed:BottomView_Identi owner:nil options:nil].lastObject;
        _bottom.delegate = self;
        
        
    }
    return  _bottom;
}
-(instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style{
    if (self = [super initWithFrame:frame style:style]) {
        self.scrollEnabled = YES;
    }
    return  self;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return  self.sourceMut.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BaseTypeCell *cell =  (BaseTypeCell *)[super tableView:tableView cellForRowAtIndexPath:indexPath];
    
    cell.text = self.sourceMut[indexPath.row];
    
    if (indexPath.row == self.sourceMut.count - 1) {
        [cell addSubview:self.bottom];
        self.bottom.frame = CGRectMake(0, 0, cell.bounds.size.width,cell.bounds.size.height);
        
    }
    return  cell;
}
-(void)setMinPlaceHolder:(NSString *)minPlaceHolder max:(NSString *)maxPlaceHolder{
    [self.bottom setPlaceHolderMin:minPlaceHolder max:maxPlaceHolder];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == self.sourceMut.count - 1) {
        return  LastCell_hight;
    }
    
    return  CellHight;
}


#pragma mark --bottomViewDelegate
-(void)BottomView:(BottomView *)bottom sendMin:(NSString *)min max:(NSString *)max{
    if ([self.BaseDelegate respondsToSelector:@selector(BaseTypeTableVeiw:sendMin:max:)]) {
        [self.BaseDelegate BaseTypeTableVeiw:self sendMin:min max:max];
    }
    
}


@end
